public class Thread_Priority {

    public static void main(String[] args) {
        System.out.println(Thread.currentThread().getName()+"--->"+Thread.currentThread().getPriority());

        MyThread myThread = new MyThread();

        Thread t0 = new Thread(myThread);
        Thread t1 = new Thread(myThread);
        Thread t2 = new Thread(myThread);

        t0.start();//5
        //先设置优先级，再启动。
        t1.setPriority(1);
        t1.start();

        t2.setPriority(Thread.MAX_PRIORITY);//10
        t2.start();
    }

}

class MyThread implements Runnable{

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+"--->"+Thread.currentThread().getPriority());
    }
}

